package com.ruoyi.traces.service.impl;

import com.ruoyi.traces.domain.TraceTask;
import com.ruoyi.traces.domain.vo.MaterialVo;
import com.ruoyi.traces.mapper.TraceTaskMapper;
import com.ruoyi.traces.mapper.TraceTransportMapper;
import com.ruoyi.traces.mapper.TraceUserCropsMapper;
import com.ruoyi.traces.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductServiceImpl implements ProductService {
    @Autowired
    private TraceTransportMapper traceTransportMapper;
    @Autowired
    private TraceTaskMapper traceTaskMapper;
    @Autowired
    private TraceUserCropsMapper traceUserCropsMapper;



    public List<MaterialVo> selectProductList() {
        return traceTransportMapper.selectProductList();
    }
    @Override
    public List<MaterialVo> queryProductList(Integer deptId) {
        return traceTransportMapper.queryProductList(deptId);
    }

    @Override
    public int addTask(TraceTask traceTask) {
        return traceTaskMapper.insertSelective(traceTask);
    }

    @Override
    public int updateMachingStatus(MaterialVo materialVo) {
        return traceUserCropsMapper.updateMachingStatus(materialVo);
    }

    @Override
    public int updateProgress(TraceTask traceTask) {
        return traceTaskMapper.updateProgress(traceTask);
    }

    @Override
    public TraceTask queryTaskByCropsId(String materialId) {
        return traceTaskMapper.queryTaskByCropsId(materialId);
    }

    @Override
    public int updateProductWriteStatus(String cropsId) {
        return traceUserCropsMapper.updateProductWriteStatus(cropsId);
    }

    @Override
    public List<TraceTask> queryTaskList() {
        return traceTaskMapper.queryTaskList();
    }

    @Override
    public int productOutFactory(String materialId) {
        //traceUserCropsMapper.updateFactoryStatus(materialId);
        return traceUserCropsMapper.productOutFactory(materialId);
    }
}
